import { Component, OnInit } from '@angular/core';
import {RollService} from "../../../../../my-service/roll.service";
import {  ActivatedRoute } from '@angular/router';
import {UtilService} from "../../../../../my-service/util.service";
@Component({
  selector: 'app-roll-setting',
  templateUrl: './roll-setting.component.html',
  styleUrls: ['./roll-setting.component.css'],
})
export class RollSettingComponent implements OnInit {
  selectedValue = "0.2";
  url='';
  rollSetting={
    isEditor:false,
    rollMoudleArr:[],
    isAddModule:false,
    isBigCode:false,//放大二维码
    classGuid:null,
    classInfo:{
      ClassName:'',
      CreateTime:'',
      EndTime:'',
      IDCode:'',
      InvitationCode:'',
      Number:''
    },
    onCloseAdd:function (event) {
      this.isAddModule = event;
    },
    onCloseCode:function (event) {
      this.isBigCode = event;
    }
  };
  constructor(
      private rollServe:RollService,
      private  routserInfo:ActivatedRoute,
      private  utilServe:UtilService
  ) { }
  getClassInfo(classGuid){
    this.rollServe.getClassInfo(classGuid).then(res=>{
      if(res.status==1){
        this.rollSetting.classInfo = res.data[0];
        this.url = 'http://mclientroster.lessonplan.cn/#/home/joinRoll;search='+res.data[0].IDCode;
      }else {
        console.log(res);
      }
    })
  }
  ngOnInit() {
  this.rollSetting.rollMoudleArr.length = 5;
  this.rollSetting.classGuid = this.routserInfo.snapshot.params['id'];
  this.getClassInfo(this.rollSetting.classGuid);
  }
}
